diff --git a/web/media/multimedia-modal.react.js b/web/media/multimedia-modal.react.js --- a/web/media/multimedia-modal.react.js +++ b/web/media/multimedia-modal.react.js @@ -9,6 +9,7 @@ import css from './media.css'; type BaseProps = { + +type: string, +uri: string, }; @@ -26,6 +27,17 @@ } render(): React.Node { + let mediaModalItem; + if (this.props.type === 'photo') { + mediaModalItem = ; + } else { + mediaModalItem = ( + + ); + } + return (
- + {mediaModalItem} void = () => { - const { pushModal, uri } = this.props; - pushModal(); + const { pushModal, type, uri } = this.props; + pushModal(); }; } diff --git a/web/modals/threads/gallery/thread-settings-media-gallery.react.js b/web/modals/threads/gallery/thread-settings-media-gallery.react.js --- a/web/modals/threads/gallery/thread-settings-media-gallery.react.js +++ b/web/modals/threads/gallery/thread-settings-media-gallery.react.js @@ -3,11 +3,14 @@ import * as React from 'react'; import { fetchThreadMedia } from 'lib/actions/thread-actions.js'; +import { useModalContext } from 'lib/components/modal-provider.react.js'; +import type { Media } from 'lib/types/media-types.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; import { useServerCall } from 'lib/utils/action-utils.js'; import css from './thread-settings-media-gallery.css'; import Tabs from '../../../components/tabs.react.js'; +import MultimediaModal from '../../../media/multimedia-modal.react.js'; import Modal from '../../modal.react.js'; type MediaGalleryTab = 'All' | 'Images' | 'Videos'; @@ -22,6 +25,7 @@ function ThreadSettingsMediaGalleryModal( props: ThreadSettingsMediaGalleryModalProps, ): React.Node { + const { pushModal } = useModalContext(); const { onClose, parentThreadInfo, limit, activeTab } = props; const { id: threadID } = parentThreadInfo; const modalName = 'Media'; @@ -42,6 +46,13 @@ fetchData(); }, [callFetchThreadMedia, threadID, limit]); + const onClick = React.useCallback( + (media: Media) => { + pushModal(); + }, + [pushModal], + ); + const filteredMediaInfos = React.useMemo(() => { if (tab === 'Images') { return mediaInfos.filter(mediaInfo => mediaInfo.type === 'photo'); @@ -59,11 +70,15 @@ const mediaGalleryItems = React.useMemo( () => filteredMediaInfos.map((media, i) => ( -
+
onClick(media)} + className={css.mediaContainer} + >
)), - [filteredMediaInfos, mediaCoverPhotos], + [filteredMediaInfos, onClick, mediaCoverPhotos], ); const handleScroll = React.useCallback(